package com.cloudfun.campusshare.common.model.vo;

import com.cloudfun.campusshare.common.constant.ProductType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AccessLevel;
import lombok.Data;
import lombok.Getter;

import java.time.LocalTime;
import java.time.format.DateTimeFormatter;

/**
 * @author : zhangyongjie
 * @version : 1.0
 * @createTime : 2020/5/8 19:43
 * @description :
 */
@Data
@ApiModel(value = "设备服务时间列表vo")
public class DeviceServiceTimeListVO {

    @ApiModelProperty(value = "id")
    private String id;

    @ApiModelProperty(value = "开始时间")
    private LocalTime startTime;

    @ApiModelProperty(value = "结束时间")
    private LocalTime endTime;

    @ApiModelProperty(value = "商家id")
    private String merchantId;

    @ApiModelProperty(value = "运营商名称")
    private String belongMerchantName;

    @ApiModelProperty(value = "添加人id")
    private String creatorId;

    @ApiModelProperty(value = "添加人用户名")
    private String creatorName;

    @ApiModelProperty(value = "洗衣点id")
    private String washPointId;

    @ApiModelProperty(value = "洗衣点名称")
    private String washPointName;

    @ApiModelProperty(value = "添加时间")
    private String createTime;

    @ApiModelProperty(value = "服务时间")
    @Getter(AccessLevel.NONE)
    private String serviceTime;
//
//    @ApiModelProperty(value = "具体地址")
//    private WashPointConcretePositionEntity washPointConcretePositionEntity;

    @ApiModelProperty(value = "产品类型")
    private ProductType productType;

    public String getServiceTime() {
        String st = null;
        if(startTime != null){
            st = startTime.format(DateTimeFormatter.ISO_TIME);
        }
        String et = null;
        if(endTime != null){
            et = endTime.format(DateTimeFormatter.ISO_TIME);
        }
        return st + "~" + et;
    }
}
